package cn.edu.gduf.luowowo.member.service.impl;

import cn.edu.gduf.luowowo.common.query.QueryObject;
import cn.edu.gduf.luowowo.member.domain.Item;
import cn.edu.gduf.luowowo.member.mapper.ItemMapper;
import cn.edu.gduf.luowowo.member.mapper.ItemOrderMapper;
import cn.edu.gduf.luowowo.member.mapper.UserInfoMapper;
import cn.edu.gduf.luowowo.member.service.IItermService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Service
public class ItermServiceImpl implements IItermService {
    @Autowired
    private ItemMapper itemMapper;
    @Autowired
    private ItemOrderMapper itermOrderMapper;
    @Autowired
    private UserInfoMapper userInfoMapper;


    @Override
    public PageInfo<Item> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<Item> list = itemMapper.selectForList(qo);
        return new PageInfo<>(list);
    }

    @Override
    public void updateStorenum(int num, Long id) {
        itemMapper.updateStorenum(num, id);
    }

    @Override
    public Item selectByPrimaryKey(Long id) {
        return itemMapper.selectByPrimaryKey(id);
    }
}
